<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新能源汽车动力信息</title>
    <script src="${pageContext.request.contextPath}/statics/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<h1 align="center">新能源汽车动力信息</h1>
<table border="1px" align="center">
    <tr align="center">
        <td>编号</td>
        <td>车型</td>
        <td>所属城市</td>
        <td>使用单位</td>
        <td>压差报警值</td>
        <td>报警时间</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${list}" var="power">
        <tr align="center">
            <td><a href="toUpdate/${power.id}"/>${power.id}</td>
            <td>${power.carName}</td>
            <td>${power.cityName}</td>
            <td>${power.userName}</td>
            <td>${power.pressureValue}</td>
            <td>${power.time}</td>
            <td><a href="javascript:void(0)" onclick="del('${power.id}')">删除</a></td>
        </tr>
    </c:forEach>
</table>
<%--<a href="FruitListServlet">水果信息</a>&nbsp&nbsp&nbsp&nbsp&nbsp<a href="ResumeListServlet">个人简历信息列表</a>&nbsp&nbsp&nbsp&nbsp<a href="MovieLimitServlet">电影信息</a>--%>
<script>
    $(function (){
        $("table tr:odd").css("background-color","pink")
        $("table tr:eq(0)").css("background-color","yellow")
    })
    function del(id) {
        if (confirm("真的删,除行吗")) {
            $.get('${pageContext.request.contextPath}/delete/'+id,function (d) {
                if (d=="1"){
                    alert("删除成功");
                    location.href="${pageContext.request.contextPath}/List"
                }else {
                    alert("删除失败");
                    location.reload();
                }
            })
        }
    }
</script>
</body>
</html>
